create or replace view vac_app_bc_entries_4_1 as
with bce as
(
  select
    workspace,
    workspace_display_name,
    application_id,
    application_name,
    parent_breadcrumb_id,
    breadcrumb_id,
    entry_label,
    entry_long_label,
    url,
    to_char(defined_for_page) defined_for_page,
    current_for_pages,
    condition_type,
    condition_type_code,
    condition_expression1,
    condition_expression2,
    authorization_scheme,
    authorization_scheme_id,
    build_option,
    last_updated_by,
    last_updated_on,
    component_comment
  from apex_application_bc_entries
)
select
    workspace,
    workspace_display_name,
    application_id,
    application_name,
    defined_for_page,
    parent_breadcrumb_id,
    breadcrumb_id,
    authorization_scheme_id,
    last_updated_by,
    last_updated_on,
    u_value,
    u_name,
    'APEX_APPLICATION_BC_ENTRIES' src_view_name
from bce
  UNPIVOT INCLUDE NULLS (
   u_value
   FOR u_name
   IN
   (
    entry_long_label,
    url,
    entry_label,
    current_for_pages,
    condition_type,
    condition_type_code,
    condition_expression1,
    condition_expression2,
    authorization_scheme,
    build_option,
    component_comment
   )
);

